<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--商户管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
    <style>
        thead tr th{
            text-align: center;
        }
        tbody tr td{
            text-align: center;
        }
        .modal-body .nav>li>a {
            position: relative;
            display: block;
            padding: 3px 15px;
            background: #d8d8d8;
        }
        .modal-body .nav>li>a:hover{
            background: #d8d8d8;
        }
        .modal-body  .nav> li.active > a::before {
            width: 0;
            height: 0;
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-top: 8px solid #d8d8d8;
            content: " ";
            position: absolute;
            right: 50%;
            bottom: -8px;
            margin-right: -8px;
            z-index: 2;
        }
        .info-row{
            line-height: 32px;
            color: #333;
        }
        .info-row label{
            padding-left: 15px;
            padding-right: 15px;
        }
        .r-title{
            color: #333;
        }
    </style>
    <style>
        .form-self{
            display: block;
            width: 100%;
            padding: 6px 12px;
            font-size: 14px;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
            box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
            -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content" >
        <div class="page-heading mgl15 mgr15">
            <!--路径导航-->
            <ol class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="javascript:;">会员卡管理</a>
                </li>

                <li class="active">删卡会员</li>
            </ol>

        </div>
        <div class="panel panel-default panel-search mgl15 mgr15">
            <div class="panel-heading">
                <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left" style="margin-right: 10px;"></span>会员查找</h5>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">昵称：</label>
                            <div class="col-sm-9">
                                <input type="text"  autocomplete="off" disableautocomplete class="form-control"  placeholder="请输入" value="{$p_data['nickname']}" name="nickname">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">卡号：</label>
                            <div class="col-sm-9">
                                <input type="text" autocomplete="off" disableautocomplete class="form-control"  placeholder="请输入卡号" value="{$p_data['code']}" name="code">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">激活状态：</label>
                            <div class="col-sm-9">
                                <select name="fire" class="form-control">
                                    <option value="">请选择激活状态</option>
                                    <option value="1" {if condition="$p_data['fire'] eq '1'"}selected{/if}>已激活</option>
                                    <option value="0" {if condition="$p_data['fire'] eq '0'"}selected{/if}>未激活</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">积分筛选：</label>
                            <div class="col-sm-9">
                                <select name="bonus_scr" class="form-control">
                                    <option value="">请选择排序</option>
                                    <option value="1" {if condition="$p_data['bonus_scr'] eq '1'"}selected{/if}>从高到低</option>
                                    <option value="2" {if condition="$p_data['bonus_scr'] eq '2'"}selected{/if}>从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">余额筛选：</label>
                            <div class="col-sm-9">
                                <select name="balance_scr" class="form-control">
                                    <option value="">请选择排序</option>
                                    <option value="1" {if condition="$p_data['balance_scr'] eq '1'"}selected{/if}>从高到低</option>
                                    <option value="2" {if condition="$p_data['balance_scr'] eq '2'"}selected{/if}>从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">领取时间筛选：</label>
                            <div class="col-sm-9">
                                <select name="get_scr" class="form-control">
                                    <option value="">请选择排序</option>
                                    <option value="1" {if condition="$p_data['get_scr'] eq '1'"}selected{/if}>从早到晚</option>
                                    <option value="2" {if condition="$p_data['get_scr'] eq '2'"}selected{/if}>从晚到早</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>
        </div>
        <div class="alert alert-success" style="background-color: rgba(204, 228, 223, 0.3);margin: 5px 10px 5px 10px;">
            <strong>
                <i class="ti-info-alt"></i>
            </strong>
            会员卡管理（旧）中，统计显示只到2018-9-1日之前，之后的不再做统计，数据可能会和现用的数据统计及显示有所差异，2018-9-1日起的数据全部以现有的会员卡管理中为准。
        </div>
        <div class="panel mgl15 mgr15" >

            <div class="panel-heading addCharts" style="background:#ededed;">
                会员列表
            </div>
            <div class="panel-body">
                <table class="table table-bordered" data-toolbar="#toolbar">
                    <thead>
                    <tr>
                        <th>会员卡号</th>
                        <th>状态</th>
                        <th>昵称</th>
                        <th>手机号</th>
                        <th>退卡时间</th>
                        <th>积分</th>
                        <th>余额</th>
                        <th>使用频次</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td><a class="btn-link" data-toggle="modal"  data-target="#myModal" data-id="{$vo.id}">{$vo.code}</a></td>
                        <td>
                            {switch name="vo.fire"}
                            {case value="1"}已激活{/case}
                            {case value="0"}未激活{/case}
                            {/switch}
                        </td>
                        <td>
                            {eq name="vo.fire" value="1"}
                            {$vo.nickname}
                            {else/}
                            未获取
                            {/eq}
                        </td>
                        <td>{$vo.phone}</td>
                        <td>{$vo.del_time|date='Y-m-d H:i:s',###}</td>
                        <td>{$vo.bonus}</td>
                        <td>{$vo.balance}</td>
                        <td>{:get_cardus_frequency($vo['openid'])}/次</td>
                        <td class="chakan">

                            {if condition="checkPath('cardusold/cardusbalanceold')"}
                            <a class="btn-link" href="{:url('cardusold/cardusbalanceold',['get_id'=>$vo['id']])}">消费明细</a>
                            {/if}

                        </td>

                    </tr>
                    {/volist}
                    </tbody>
                </table>
                {$list->render()}
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>

<!-- 会员资料Modal -->
<div class="modal fade bs-example-modal-sm" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-sm" role="document" style="width: 798px;height: 320px;">
        <div class="modal-content" style="height: 100%;">
            <div class="modal-body">
                <div id="info_nickname">
                    <span style="font-size: 22px;" id="nick-name"></span>
                </div>
                <!-- Tab panes -->
                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane active" id="home">
                        <div class="r-title" style="line-height: 42px;font-size: 18px;font-weight: 700;border-bottom: 1px solid #ddd;margin-top: 12px;margin-bottom: 12px;">
                            会员资料
                        </div>
                        <div class="row info-row" id="templateHtml">
                            <script id="modallist" type="text/html">
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">昵称：</label>
                                    <div class="col-xs-8 ng-binding">{{list.nickname}}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right">会员卡号：</label>
                                    <div class="col-xs-8">{{list.code}}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">积分：</label>
                                    <div class="col-xs-8 ng-binding">{{list.bonus}}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">余额：</label>
                                    <div class="col-xs-8">{{list.balance}}</div>
                                </div>
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_MOBILE')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">手机号：</label>
                                    <div class="col-xs-8">{{list.phone}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_SEX')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">性别：</label>
                                    {{ if list.sex == '1'}}
                                    <div class="col-xs-8">男</div>
                                    {{/if}}
                                    {{ if list.sex == '0' }}
                                    <div class="col-xs-8">女</div>
                                    {{/if}}
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_NAME')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">姓名：</label>
                                    <div class="col-xs-8">{{list.name}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_LOCATION')" value="1"}
                                <div class="col-xs-6 ng-scope">
                                    <label class="col-xs-4 text-right ng-binding">地址：</label>
                                    <div class="col-xs-8">{{list.address}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_BIRTHDAY')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">生日：</label>
                                    <div class="col-xs-8">{{list.birthday}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_IDCARD')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">身份证：</label>
                                    <div class="col-xs-8">{{list.idnumber}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_EMAIL')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">邮箱：</label>
                                    <div class="col-xs-8">{{list.email}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_INDUSTRY')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">行业：</label>
                                    <div class="col-xs-8">{{list.industry}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_INCOME')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">收入：</label>
                                    <div class="col-xs-8">{{list.income}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_HABIT')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">兴趣爱好：</label>
                                    <div class="col-xs-8">{{list.habit}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_EDUCATION_BACKGRO')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">教育背景：</label>
                                    <div class="col-xs-8">{{list.backgro}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'实体卡号')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">实体卡号：</label>
                                    <div class="col-xs-8">{{list.old_code}}</div>
                                </div>
                                {/eq}
                            </script>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__STATIC_URL__/static/js/template.js"></script>
<script src="__STATIC_URL__/static/layer/layer.js"></script>
<script>

    $(function(){
//        会员卡资料
        $("#myModal").on("show.bs.modal",function(){
            var id = $(event.target).data("id");
            var datas = {};
            $.ajax({
                url:"{:url('cardusold/getcardinfoold')}",
                type:"post",
                data:{
                    id:id
                },
                success:function(data){
                    console.log(333,data);
                    $("#nick-name").text(data.nickname);
                    datas.list = data;
                    var html = template('modallist', datas);
                    $("#templateHtml").html(html);
                }
            })
        })
    })
</script>
</body>


</html>
